B-Tree dictionary template definition. More...
#include <tbtreedictionary.h>
Public Member Functions | |
TBTreeDictionary (int32 order=3) | |
Default constructor. | |
TBTreeDictionary (const TBTreeDictionary< K, O > &dict) | |
Copy constructor. | |
~TBTreeDictionary () | |
Destructor. | |
TBTreeDictionary< K, O > & | operator= (const TBTreeDictionary< K, O > &dict) |
Assignment operator. | |
bool | addKey (const K &key) |
Add an association with a key and a default object. | |
bool | addKeyAndObject (const K &key, const O &object) |
Add an association with a key and an object. | |
bool | addAssoc (const TAssociation< K, O > &assoc) |
Add the passed association. | |
bool | replace (const K &key, const O &object) |
Replace the object associated with key with the passed object. | |
bool | removeKey (const K &key) |
Remove the association with the key. | |
const K & | lookupKey (const K &key) const |
Returns an equal key contained in the dictionary. | |
const O & | lookupObject (const K &key) const |
Returns the object associated with key. | |
bool | containsKey (const K &key) const |
Returns if the key is contained in the dictionary. | |
const TAssociation< K, O > & | lookupAssoc (const K &key) const |
Lookup an association, that has the passed key. |
B-Tree dictionary template definition.
TBTreeDictionary is a template class for managing (key, object) pairs in a TBTree. The (key, object) pairs are stored as TAssociation objects. Every key can only be used once in the dictionary. For more information about TBTree (which should not be confused with a "binary tree", which is in tbinarytree.h) see the tbtree.h header.
TBTreeDictionary | ( | int32 | order = 3 |
) | [inline] |
Default constructor.
"TBTreeDictionary" is the default dictionary constructor.
order | the order of the B-Tree is the maximum number of children for each node. Order has to be >= 3. |
TBTreeDictionary | ( | const TBTreeDictionary< K, O > & | dict | ) | [inline] |
Copy constructor.
~TBTreeDictionary | ( | ) | [inline] |
Destructor.
TBTreeDictionary< K, O > & operator= | ( | const TBTreeDictionary< K, O > & | dict | ) | [inline] |
Assignment operator.
Assignment operator "=" copies the specified dictionary into this dictionary.
bool addKey | ( | const K & | key | ) | [inline] |
Add an association with a key and a default object.
"addKey" adds an association with the specified key to the dictionary. If the key is already contained in the dictionary nothing is added.
bool addKeyAndObject | ( | const K & | key, | |
const O & | obj | |||
) | [inline] |
Add an association with a key and an object.
"addKeyAndObject" adds an association with the specified key and the specified object to the dictionary. If the key is already contained in the dictionary nothing is added.
bool addAssoc | ( | const TAssociation< K, O > & | assoc | ) | [inline] |
Add the passed association.
"addAssoc" adds the specified association to the dictionary. If the key of the association is already contained in the dictionary nothing is added.
bool replace | ( | const K & | key, | |
const O & | obj | |||
) | [inline] |
Replace the object associated with key with the passed object.
"replace" finds the first occurrence of an association containing the specified key and replaces the object value. If the key is not contained in the dictionary nothing is done.
bool removeKey | ( | const K & | key | ) | [inline] |
Remove the association with the key.
"removeKey" removes the first association containing the specified key from the dictionary.
const K & lookupKey | ( | const K & | key | ) | const [inline] |
Returns an equal key contained in the dictionary.
const O & lookupObject | ( | const K & | key | ) | const [inline] |
Returns the object associated with key.
bool containsKey | ( | const K & | key | ) | const [inline] |
Returns if the key is contained in the dictionary.
const TAssociation< K, O > & lookupAssoc | ( | const K & | key | ) | const [inline] |
Lookup an association, that has the passed key.